package archer.framework.client.config;

import archer.framework.client.ArcherClientModule;

import static archer.framework.utils.ProfileUtils.*;
import static archer.framework.utils.PropertiesUtils.*;

import java.util.Properties;

/**
 * @author christ
 * @date 2016/8/17
 */
public class RemoteFileServerConfig {

    private String host;

    private static RemoteFileServerConfig instance = null;

    public static RemoteFileServerConfig instance() {

        if (instance == null) {
            instance = new RemoteFileServerConfig();
            instance.init();
        }

        return instance;
    }

    protected void init() {

        Properties properties = new Properties();
        loadFromClasspath(properties, getPropertiesFileName(ArcherClientModule.remoteInvokeConfigPath));
        host = getString(properties, "remote.file.host");
    }

    public String getHost() {
        return host;
    }

    public RemoteFileServerConfig setHost(String host) {
        this.host = host;
        return this;
    }
}
